// Copyright (c) 2022.
// Written by Li Yanxiao. All rights reserved

//
// Created by 李彦筱 on 2022/10/8.
//

#ifndef SIGNED_DISTANCE_FIELD_LINE_H
#define SIGNED_DISTANCE_FIELD_LINE_H

#include <Eigen/Dense>

/*
 * 表示一条线段
 * 成员：
 * b：ax+by+c=0标准解析式中，a=1时b的值
 * c: ax+by+c=0中，a=1时c的值
 * start_point:线段起点
 * end_point:线段终点
 * vector:表示线段长度的向量
 */
class Line{
private:
    double b;
    double c;
    Eigen::Vector2i start_point;
    Eigen::Vector2i end_point;
public:
    const Eigen::Vector2i &getStartPoint() const;

    __attribute__((unused)) void setStartPoint(const Eigen::Vector2i &startPoint);

    const Eigen::Vector2i &getEndPoint() const;

    __attribute__((unused)) void setEndPoint(const Eigen::Vector2i &endPoint);

    double getC() const;

    double getB() const;

    Eigen::Vector2i vector() const;

    friend std::ostream &operator<<(std::ostream &os, const Line &line);

    double y(double x) const;

    Line(const Eigen::Vector2i &startPoint, const Eigen::Vector2i &endPoint);

    Line();
};

#endif //SIGNED_DISTANCE_FIELD_LINE_H
